package tpf.designer.pattern.course7.behavior_pattern2.homework.exercise2;

import org.apache.log4j.Logger;
import org.junit.Test;

import java.util.Random;

public class Client {

    /*public static final Logger LOGGER = Logger.getLogger(Client.class);
    private static final LoginStrategy[] loginStrategies = new LoginStrategy[]{
            new PasswordLoginStrategy(),
            new ScancodeLoginStrategy()
    };
    private  LoginStrategy chooseLoginType(){
        Random r = new Random();
        int i = r.nextInt(loginStrategies.length);
        return loginStrategies[i];
    }

    public boolean login(){
        LoginStrategy s = chooseLoginType();
        return s.doLogin();
    }*/

    /*@Test
    public void testLogin(){
        //选择并创建需要使用的策略对象
        LoginStrategy loginStrategy = new PasswordLoginStrategy();
//        LoginStrategy loginStrategy = new ScancodeLoginStrategy();
        LoginStrategyObj loginStrategyObj = new LoginStrategyObj(loginStrategy);
        LOGGER.info(loginStrategyObj.selectLoginComponent());
    }*/

    @Test
    public void testRandomLogin(){
        LoginStrategyObj loginStrategyObj = new LoginStrategyObj();
        loginStrategyObj.login();

    }
}
